package ltd.trackan.graphvalidatecode.controller;


import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import ltd.trackan.common.model.entity.RestBean;
import ltd.trackan.graphvalidatecode.service.CaptchaService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * @author lijian
 */
@RestController
@RequestMapping("/captcha")
@Tag(name = "图形验证码")
public class CaptchaController {

	@Resource
	private CaptchaService captchaService;

	@Operation(summary = "获取验证码图片")
	@GetMapping("getCaptchaCode")
	public void getCaptchaCode(HttpServletResponse response) {
		captchaService.getCaptchaCodeImage(response);
	}

	@Operation(summary = "获取验证码文本")
	@GetMapping("getCaptchaCodeText")
	public RestBean<String> getCaptchaCodeText() {
		return captchaService.getCaptchaCodeText();
	}

}
